/**
* Copyright @ 2023 iAuto (Shanghai) Co., Ltd.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are NOT permitted except as agreed by
* iAuto (Shanghai) Co., Ltd.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/


import request from '@/utils/request';
import base from "./base";
export async function getList(data: any) {
  const { pageNumber, pageSize, ...other } = data;
  return request(`/${base.API}/scenario-ms/${base.VERSION}/admin/scenesRecord/page`, {
    method: 'get',
    params: {
      pageNumber,
      pageSize,
      ...other
    },
  });
}

export async function auditService(data: any) {
  const { scenarioRecordUid, auditResult, rejectReason, auditStatus } = data;
  return request(`/${base.API}/scenario-ms/${base.VERSION}/admin/scenes/audit/${scenarioRecordUid}`, {
    method: 'post',
    data: {
      auditResult,
      rejectReason,
      auditStatus
    }
  });
}

export async function getDetail(data: any) {
  return request(`/${base.API}/scenario-ms/${base.VERSION}/admin/scenesRecord/${data.id}`, {
    method: 'get',
  });
}
export async function getTypeList() {
  return request(`/${base.API}/scenario-ms/${base.VERSION}/admin/category`, {
    method: 'get',
    params: {
      status: 0
    }
  });
}

export async function getAgreeService(uuid: any) {
  return request(`/${base.API}/home-ms/${base.VERSION}/protocols/${uuid}`, {
    method: 'get',
  });
}

export async function getAgreeListService(data: any) {
  const { type } = data;
  return request(`/${base.API}/home-ms/${base.VERSION}/protocols`, {
    method: 'get',
    params: {
      type
    }
  });
}

export async function typeChangeService(data: any) {
  const { scenarioRecordUid, categoryName, categoryUuid } = data;
  return request(`/${base.API}/scenario-ms/${base.VERSION}/admin/scenesRecord/${scenarioRecordUid}`, {
    method: 'put',
    data: {
      categoryName,
      categoryUuid
    }
  });
}
